package com.isunland.managesystem.utils;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.view.View;

/**
 * 对象功能:
 * 开发公司: 北京信普达系统工程有限公司
 * 开发人员: wangyanan
 * 创建时间: 2017/5/4 13:58
 */

public class FUtils {
  public void revealShow(final View view, boolean reveal) {

    if (reveal) {
      ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 0f, 1f);
      animator.setDuration(300); //ms
      animator.addListener(new AnimatorListenerAdapter() {
        @Override public void onAnimationStart(Animator animation) {
          view.setVisibility(View.VISIBLE);
        }
      });
      animator.start();
    } else {

      ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.ALPHA, 1f, 0f);
      animator.setDuration(300); //ms
      animator.addListener(new AnimatorListenerAdapter() {
        @Override public void onAnimationEnd(Animator animation) {
          view.setVisibility(View.GONE);
        }
      });
      animator.start();
    }
  }
}
